package jude.java.money.beans;

import java.util.Date;

/**
 * 扫描得到的FTP站点
 * */
public class ScanFtp extends Ftp {
	private static final long serialVersionUID = 2173050952469198801L;
	
	public static final int STATE_IGNORE	= -10000;		//忽略
	public static final int STATE_USER		= -100;			//用户名错误
	public static final int STATE_ERROR		= -20;			//出现错误
	public static final int STATE_NOT_FOUND	= -4;			//根据目前的策略, 无法找出用户名密码
	public static final int STATE_DENEY		= -3;			//拒绝连接或超过重试次数, 没有完成
	public static final int STATE_CONNECT 	= -2;			//无法连接
	public static final int STATE_SCANNING 	= -1;			//正在扫描
	public static final int STATE_NEW 		= 0;			//新增加的, 待扫描
	public static final int STATE_FTP 		= 1;			//成功获得用户名和密码
	
	private int state;
	/**
	 * FTP欢迎词
	 * */
	private String title;
	private Date insertTime;
	private Date scanTime;
	private long level;
	
	public ScanFtp() {
	}
	
	public ScanFtp(String host, String title) {
		super(host);
		this.title = title;
		this.insertTime = new Date();
	}
	
	public long getLevel() {
		return level;
	}
	public void setLevel(long level) {
		this.level = level;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}

	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	public Date getScanTime() {
		return scanTime;
	}

	public void setScanTime(Date scanTime) {
		this.scanTime = scanTime;
	}
	
	//////////////////////////////////////
	
	public void scanned(int level) {
		this.level |= (1L << level);
	}
	
	public boolean hasScanned(int level) {
		return (this.level & (1L << level)) > 0;
	}
}
